package com.example.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.crm.entity.CustomerTag;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 客户标签Mapper接口
 */
@Mapper
public interface CustomerTagMapper extends BaseMapper<CustomerTag> {
    
    /**
     * 根据客户ID查询标签列表
     */
    @Select("SELECT t.* FROM crm_customer_tag t " +
            "INNER JOIN crm_customer_tag_relation r ON t.id = r.tag_id " +
            "WHERE r.customer_id = #{customerId} AND t.deleted = 0")
    List<CustomerTag> selectTagsByCustomerId(@Param("customerId") Long customerId);
} 